import 'package:flutter/material.dart';
import 'package:fzcgx_app/common/adapter_utils.dart';
import 'package:fzcgx_app/common/assets_utils.dart';
import 'package:fzcgx_app/provider/provider_widget.dart';
import 'package:fzcgx_app/ui/order/page/order_add/order_add_colour_page.dart';
import 'package:fzcgx_app/ui/order/page/order_add/order_add_size_page.dart';
import 'package:fzcgx_app/ui/order/view_model/order_add_view_model.dart';
import 'package:fzcgx_app/ui/widget/custom_appbar_widget.dart';
import 'package:nav_router/nav_router.dart';

class OrderAddPage extends StatefulWidget {
  OrderAddPage({Key key}) : super(key: key);

  @override
  _OrderAddPageState createState() => _OrderAddPageState();
}

class _OrderAddPageState extends State<OrderAddPage> {
  @override
  Widget build(BuildContext context) {
    return ProviderWidget<OrderAddViewModel>(
      model: OrderAddViewModel(),
      builder: (context, viewModel, child) {
        return Scaffold(
          backgroundColor: Colors.white,
          appBar: CustomAppbar(
            title: '发布订单',
            // actions: <Widget>[
            //   InkWell(
            //       onTap: null,
            //       child: Container(
            //           alignment: Alignment.center,
            //           padding:
            //               EdgeInsets.only(right: AdapterUtils.getWidth(15)),
            //           child: Text(
            //             '新增',
            //             style: TextStyle(
            //                 color: Color(0xff15A1FF),
            //                 fontWeight: FontWeight.w500,
            //                 decoration: TextDecoration.none,
            //                 fontSize: AdapterUtils.getSp(14)),
            //           )))
            // ],
          ),
          body: SafeArea(child: _buildSuccessWidget(viewModel)),
        );
      },
    );
  }

  _buildSuccessWidget(OrderAddViewModel viewModel) {
    return SingleChildScrollView(
        child: Column(children: <Widget>[
      SizedBox(
        height: AdapterUtils.getHeight(4),
      ),
      Container(
        height: AdapterUtils.getHeight(38),
        color: Color(0xffEAF7FE),
        child: Center(
          child: Text(
            '要求高的订单，订单类型建议选择抢单',
            style: TextStyle(
              fontSize: AdapterUtils.getSp(13),
              color: Color(0xff15A1FF),
              fontWeight: FontWeight.w500,
            ),
          ),
        ),
      ),
      SizedBox(
        height: AdapterUtils.getHeight(28),
      ),
      InkWell(
        onTap: () {
          viewModel.bindRobType(context);
        },
        child: Container(
          margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
          decoration: BoxDecoration(
              border: Border(
                  bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              RichText(
                text: TextSpan(children: <InlineSpan>[
                  TextSpan(
                    text: '*',
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(14),
                      color: Color(0xffFF3D3E),
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                  TextSpan(
                    text: ' 订单类型',
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(14),
                      color: Color(0xff606B79),
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                ]),
              ),
              Row(
                children: <Widget>[
                  Expanded(
                      child: TextField(
                    controller: viewModel.robTypeController,
                    enabled: false,
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(18),
                      color: Color(0xff3B4859),
                      fontWeight: FontWeight.w500,
                    ),
                    decoration: InputDecoration(
                        contentPadding: EdgeInsets.only(
                            top: AdapterUtils.getHeight(10),
                            bottom: AdapterUtils.getHeight(20)),
                        hintText: '请选择',
                        border: InputBorder.none,
                        hintStyle: TextStyle(
                          fontSize: AdapterUtils.getSp(18),
                          color: Color(0xffD7D8DB),
                          fontWeight: FontWeight.w500,
                        )),
                  )),
                  Image.asset(
                      AssetsUtils.getAssetsImagesPath('home_arrow_right.png'))
                ],
              )
            ],
          ),
        ),
      ),
     viewModel.robType == 1? Column(
        children: <Widget>[
          SizedBox(
            height: AdapterUtils.getHeight(24),
          ),
          Container(
            margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
            decoration: BoxDecoration(
                border: Border(
                    bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                RichText(
                  text: TextSpan(children: <InlineSpan>[
                    TextSpan(
                      text: '*',
                      style: TextStyle(
                        fontSize: AdapterUtils.getSp(14),
                        color: Color(0xffFF3D3E),
                        fontWeight: FontWeight.w500,
                      ),
                    ),
                    TextSpan(
                      text: ' 抢单保证金（元）',
                      style: TextStyle(
                        fontSize: AdapterUtils.getSp(14),
                        color: Color(0xff606B79),
                        fontWeight: FontWeight.w500,
                      ),
                    ),
                  ]),
                ),
                TextField(
                   controller: viewModel.earnestController,
                  keyboardType: TextInputType.numberWithOptions(),
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(18),
                    color: Color(0xff3B4859),
                    fontWeight: FontWeight.w500,
                  ),
                  decoration: InputDecoration(
                      contentPadding: EdgeInsets.only(
                          top: AdapterUtils.getHeight(10),
                          bottom: AdapterUtils.getHeight(20)),
                      hintText: '请输入抢单保证金',
                      border: InputBorder.none,
                      hintStyle: TextStyle(
                        fontSize: AdapterUtils.getSp(18),
                        color: Color(0xffD7D8DB),
                        fontWeight: FontWeight.w500,
                      )),
                )
              ],
            ),
          ),
        ],
      ):Container(),
      SizedBox(
        height: AdapterUtils.getHeight(24),
      ),
      Container(
        margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
        decoration: BoxDecoration(
            border:
                Border(bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            RichText(
              text: TextSpan(children: <InlineSpan>[
                TextSpan(
                  text: '*',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xffFF3D3E),
                    fontWeight: FontWeight.w500,
                  ),
                ),
                TextSpan(
                  text: ' 产品名称',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xff606B79),
                    fontWeight: FontWeight.w500,
                  ),
                ),
              ]),
            ),
            TextField(
               controller: viewModel.proNameController,
              style: TextStyle(
                fontSize: AdapterUtils.getSp(18),
                color: Color(0xff3B4859),
                fontWeight: FontWeight.w500,
              ),
              decoration: InputDecoration(
                  contentPadding: EdgeInsets.only(
                      top: AdapterUtils.getHeight(10),
                      bottom: AdapterUtils.getHeight(20)),
                  hintText: '请输入',
                  border: InputBorder.none,
                  hintStyle: TextStyle(
                    fontSize: AdapterUtils.getSp(18),
                    color: Color(0xffD7D8DB),
                    fontWeight: FontWeight.w500,
                  )),
            )
          ],
        ),
      ),
      SizedBox(
        height: AdapterUtils.getHeight(24),
      ),
      Container(
        margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
        decoration: BoxDecoration(
            border:
                Border(bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            RichText(
              text: TextSpan(children: <InlineSpan>[
                TextSpan(
                  text: '*',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xffFF3D3E),
                    fontWeight: FontWeight.w500,
                  ),
                ),
                TextSpan(
                  text: ' 款式名称',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xff606B79),
                    fontWeight: FontWeight.w500,
                  ),
                ),
              ]),
            ),
            TextField(
               controller: viewModel.proStyleController,
              style: TextStyle(
                fontSize: AdapterUtils.getSp(18),
                color: Color(0xff3B4859),
                fontWeight: FontWeight.w500,
              ),
              decoration: InputDecoration(
                  contentPadding: EdgeInsets.only(
                      top: AdapterUtils.getHeight(10),
                      bottom: AdapterUtils.getHeight(20)),
                  hintText: '请输入',
                  border: InputBorder.none,
                  hintStyle: TextStyle(
                    fontSize: AdapterUtils.getSp(18),
                    color: Color(0xffD7D8DB),
                    fontWeight: FontWeight.w500,
                  )),
            )
          ],
        ),
      ),
      SizedBox(
        height: AdapterUtils.getHeight(24),
      ),
      Container(
        margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
        decoration: BoxDecoration(
            border:
                Border(bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            RichText(
              text: TextSpan(children: <InlineSpan>[
                TextSpan(
                  text: '*',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xffFF3D3E),
                    fontWeight: FontWeight.w500,
                  ),
                ),
                TextSpan(
                  text: '款号',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xff606B79),
                    fontWeight: FontWeight.w500,
                  ),
                ),
              ]),
            ),
            TextField(
               controller: viewModel.styleNoController,
              style: TextStyle(
                fontSize: AdapterUtils.getSp(18),
                color: Color(0xff3B4859),
                fontWeight: FontWeight.w500,
              ),
              decoration: InputDecoration(
                  contentPadding: EdgeInsets.only(
                      top: AdapterUtils.getHeight(10),
                      bottom: AdapterUtils.getHeight(20)),
                  hintText: '请输入',
                  border: InputBorder.none,
                  hintStyle: TextStyle(
                    fontSize: AdapterUtils.getSp(18),
                    color: Color(0xffD7D8DB),
                    fontWeight: FontWeight.w500,
                  )),
            )
          ],
        ),
      ),
      SizedBox(
        height: AdapterUtils.getHeight(24),
      ),
      InkWell(
        onTap: () {
          routePush(OrderAddColourPage(
            callback: (selectModels) {
              viewModel.setOrderColourModel(selectModels);
            },
          ));
        },
        child: Container(
          margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
          decoration: BoxDecoration(
              border: Border(
                  bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              RichText(
                text: TextSpan(children: <InlineSpan>[
                  TextSpan(
                    text: '*',
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(14),
                      color: Color(0xffFF3D3E),
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                  TextSpan(
                    text: ' 款式颜色',
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(14),
                      color: Color(0xff606B79),
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                ]),
              ),
              Row(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  Expanded(
                      child: TextField(
                    controller: viewModel.coloureController,
                    enabled: false,
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(18),
                      color: Color(0xff3B4859),
                      fontWeight: FontWeight.w500,
                    ),
                    decoration: InputDecoration(
                        contentPadding: EdgeInsets.only(
                            top: AdapterUtils.getHeight(10),
                            bottom: AdapterUtils.getHeight(20)),
                        hintText: '请添加您的款式颜色',
                        border: InputBorder.none,
                        hintStyle: TextStyle(
                          fontSize: AdapterUtils.getSp(18),
                          color: Color(0xffD7D8DB),
                          fontWeight: FontWeight.w500,
                        )),
                  )),
                  Image.asset(
                      AssetsUtils.getAssetsImagesPath('home_arrow_right.png'))
                ],
              )
            ],
          ),
        ),
      ),
      SizedBox(
        height: AdapterUtils.getHeight(24),
      ),
      InkWell(
        onTap: () {
          routePush(OrderAddSizePage(
            callback: (selectModels) {
              viewModel.setOrderSizeModel(selectModels);
            },
          ));
        },
        child: Container(
          margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
          decoration: BoxDecoration(
              border: Border(
                  bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              RichText(
                text: TextSpan(children: <InlineSpan>[
                  TextSpan(
                    text: '*',
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(14),
                      color: Color(0xffFF3D3E),
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                  TextSpan(
                    text: '尺码',
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(14),
                      color: Color(0xff606B79),
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                ]),
              ),
              Row(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  Expanded(
                      child: TextField(
                    controller: viewModel.sizeController,
                    enabled: false,
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(18),
                      color: Color(0xff3B4859),
                      fontWeight: FontWeight.w500,
                    ),
                    decoration: InputDecoration(
                        contentPadding: EdgeInsets.only(
                            top: AdapterUtils.getHeight(10),
                            bottom: AdapterUtils.getHeight(20)),
                        hintText: '请添加您的款式尺码',
                        border: InputBorder.none,
                        hintStyle: TextStyle(
                          fontSize: AdapterUtils.getSp(18),
                          color: Color(0xffD7D8DB),
                          fontWeight: FontWeight.w500,
                        )),
                  )),
                  Image.asset(
                      AssetsUtils.getAssetsImagesPath('home_arrow_right.png'))
                ],
              )
            ],
          ),
        ),
      ),
      SizedBox(
        height: AdapterUtils.getHeight(24),
      ),
      Container(
        margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
        decoration: BoxDecoration(
            border:
                Border(bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            RichText(
              text: TextSpan(children: <InlineSpan>[
                TextSpan(
                  text: '*',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xffFF3D3E),
                    fontWeight: FontWeight.w500,
                  ),
                ),
                TextSpan(
                  text: ' 单价（元）',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xff606B79),
                    fontWeight: FontWeight.w500,
                  ),
                ),
              ]),
            ),
            TextField(
               controller: viewModel.priceController,
              keyboardType: TextInputType.numberWithOptions(),
              style: TextStyle(
                fontSize: AdapterUtils.getSp(18),
                color: Color(0xff3B4859),
                fontWeight: FontWeight.w500,
              ),
              decoration: InputDecoration(
                  contentPadding: EdgeInsets.only(
                      top: AdapterUtils.getHeight(10),
                      bottom: AdapterUtils.getHeight(20)),
                  hintText: '请输入',
                  border: InputBorder.none,
                  hintStyle: TextStyle(
                    fontSize: AdapterUtils.getSp(18),
                    color: Color(0xffD7D8DB),
                    fontWeight: FontWeight.w500,
                  )),
            )
          ],
        ),
      ),
      SizedBox(
        height: AdapterUtils.getHeight(24),
      ),
      Container(
        margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
        decoration: BoxDecoration(
            border:
                Border(bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            RichText(
              text: TextSpan(children: <InlineSpan>[
                TextSpan(
                  text: '*',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xffFF3D3E),
                    fontWeight: FontWeight.w500,
                  ),
                ),
                TextSpan(
                  text: '数量（件）',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xff606B79),
                    fontWeight: FontWeight.w500,
                  ),
                ),
              ]),
            ),
            TextField(
               controller: viewModel.numController,
              style: TextStyle(
                fontSize: AdapterUtils.getSp(18),
                color: Color(0xff3B4859),
                fontWeight: FontWeight.w500,
              ),
              decoration: InputDecoration(
                  contentPadding: EdgeInsets.only(
                      top: AdapterUtils.getHeight(10),
                      bottom: AdapterUtils.getHeight(20)),
                  hintText: '请输入',
                  border: InputBorder.none,
                  hintStyle: TextStyle(
                    fontSize: AdapterUtils.getSp(18),
                    color: Color(0xffD7D8DB),
                    fontWeight: FontWeight.w500,
                  )),
            )
          ],
        ),
      ),
      SizedBox(
        height: AdapterUtils.getHeight(24),
      ),
      InkWell(
        onTap: () {
          viewModel.showDate(context);
        },
        child: Container(
          margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
          decoration: BoxDecoration(
              border: Border(
                  bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              RichText(
                text: TextSpan(children: <InlineSpan>[
                  TextSpan(
                    text: '*',
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(14),
                      color: Color(0xffFF3D3E),
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                  TextSpan(
                    text: ' 抢单截止时间',
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(14),
                      color: Color(0xff606B79),
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                ]),
              ),
              Row(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  Expanded(
                      child: TextField(
                    controller: viewModel.endTimeController,
                    enabled: false,
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(18),
                      color: Color(0xff3B4859),
                      fontWeight: FontWeight.w500,
                    ),
                    decoration: InputDecoration(
                        contentPadding: EdgeInsets.only(
                            top: AdapterUtils.getHeight(10),
                            bottom: AdapterUtils.getHeight(20)),
                        hintText: '请选择',
                        border: InputBorder.none,
                        hintStyle: TextStyle(
                          fontSize: AdapterUtils.getSp(18),
                          color: Color(0xffD7D8DB),
                          fontWeight: FontWeight.w500,
                        )),
                  )),
                  Image.asset(
                      AssetsUtils.getAssetsImagesPath('home_arrow_right.png'))
                ],
              )
            ],
          ),
        ),
      ),
      SizedBox(
        height: AdapterUtils.getHeight(24),
      ),
      InkWell(
        onTap: () {
          // routePush(OrderAddCraftPage());
        },
        child: Container(
          margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
          decoration: BoxDecoration(
              border: Border(
                  bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              RichText(
                text: TextSpan(children: <InlineSpan>[
                  TextSpan(
                    text: '*',
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(14),
                      color: Color(0xffFF3D3E),
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                  TextSpan(
                    text: ' 工艺要求',
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(14),
                      color: Color(0xff606B79),
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                ]),
              ),
              Row(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  Expanded(
                      child: TextField(
                     controller: viewModel.craftController,
                    // enabled: false,
                    style: TextStyle(
                      fontSize: AdapterUtils.getSp(18),
                      color: Color(0xff3B4859),
                      fontWeight: FontWeight.w500,
                    ),
                    decoration: InputDecoration(
                        contentPadding: EdgeInsets.only(
                            top: AdapterUtils.getHeight(10),
                            bottom: AdapterUtils.getHeight(20)),
                        hintText: '请输入工艺要求',
                        border: InputBorder.none,
                        hintStyle: TextStyle(
                          fontSize: AdapterUtils.getSp(18),
                          color: Color(0xffD7D8DB),
                          fontWeight: FontWeight.w500,
                        )),
                  )),
                  Image.asset(
                      AssetsUtils.getAssetsImagesPath('home_arrow_right.png'))
                ],
              )
            ],
          ),
        ),
      ),
      SizedBox(
        height: AdapterUtils.getHeight(24),
      ),
      Container(
        margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
        width: AdapterUtils.screenWidth(),
        padding: EdgeInsets.only(bottom: AdapterUtils.getHeight(24)),
        decoration: BoxDecoration(
            border:
                Border(bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            RichText(
              text: TextSpan(children: <InlineSpan>[
                TextSpan(
                  text: '*',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xffFF3D3E),
                    fontWeight: FontWeight.w500,
                  ),
                ),
                TextSpan(
                  text: ' 产品图片',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xff606B79),
                    fontWeight: FontWeight.w500,
                  ),
                ),
              ]),
            ),
            SizedBox(
              height: AdapterUtils.getHeight(12),
            ),
            Wrap(
              crossAxisAlignment: WrapCrossAlignment.start,
              runAlignment: WrapAlignment.start,
              alignment: WrapAlignment.start,
              runSpacing: 15,
              children: _buildProductPicturesWidget(viewModel),
            )
          ],
        ),
      ),
      SizedBox(
        height: AdapterUtils.getHeight(24),
      ),
      Container(
        margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
        alignment: Alignment.centerLeft,
        padding: EdgeInsets.only(bottom: AdapterUtils.getHeight(24)),
        decoration: BoxDecoration(
            border:
                Border(bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            RichText(
              text: TextSpan(children: <InlineSpan>[
                TextSpan(
                  text: '*',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xffFF3D3E),
                    fontWeight: FontWeight.w500,
                  ),
                ),
                TextSpan(
                  text: ' 合同上传',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xff606B79),
                    fontWeight: FontWeight.w500,
                  ),
                ),
              ]),
            ),
            SizedBox(
              height: AdapterUtils.getHeight(12),
            ),
            viewModel.contractPicture.isEmpty
                ? InkWell(
                    onTap: () {
                      viewModel.selectPhoto(context, 2);
                    },
                    child: Container(
                      width: AdapterUtils.getWidth(108),
                      height: AdapterUtils.getHeight(108),
                      child: Stack(
                        children: <Widget>[
                          AspectRatio(
                              aspectRatio: 1.0,
                              child: Image.asset(
                                  AssetsUtils.getAssetsImagesPath('upload.png'),
                                  fit: BoxFit.cover)),
                          Positioned(
                              bottom: AdapterUtils.getHeight(17),
                              child: Container(
                                alignment: Alignment.center,
                                width: AdapterUtils.getWidth(108),
                                child: RichText(
                                  text: TextSpan(children: <InlineSpan>[
                                    TextSpan(
                                        text: '请上传',
                                        style: TextStyle(
                                          fontSize: AdapterUtils.getSp(12),
                                          color: Color(0xff99A2AD),
                                          fontWeight: FontWeight.w500,
                                        )),
                                  ]),
                                ),
                              ))
                        ],
                      ),
                    ),
                  )
                : InkWell(
                    onTap: () {},
                    child: Container(
                      width: AdapterUtils.getWidth(108),
                      height: AdapterUtils.getHeight(108),
                      child: Stack(
                        children: <Widget>[
                          AspectRatio(
                              aspectRatio: 1.0,
                              child: Image.network(viewModel.contractPicture,
                                  fit: BoxFit.cover)),
                          Positioned(
                              top: AdapterUtils.getHeight(10),
                              right: AdapterUtils.getWidth(22),
                              child: InkWell(
                                onTap: () {
                                  viewModel.delContractPicture(context);
                                },
                                child: Container(
                                  alignment: Alignment.center,
                                  width: 24,
                                  height: 24,
                                  decoration: BoxDecoration(
                                    borderRadius:
                                        BorderRadius.all(Radius.circular(12)),
                                    color: Color(0xff000000).withOpacity(0.6),
                                  ),
                                  child: Icon(Icons.close,
                                      color: Colors.white, size: 16),
                                ),
                              ))
                        ],
                      ),
                    ),
                  )
          ],
        ),
      ),
      SizedBox(
        height: AdapterUtils.getHeight(24),
      ),
     
        Container(
          width: AdapterUtils.screenWidth(),
          height: AdapterUtils.getHeight(50),
          margin: EdgeInsets.all(15),
          child: FlatButton(
              onPressed: () {
                viewModel.postApi();
              },
              disabledColor: Color(0xff15A1FF).withAlpha(80),
              color: Color(0xff15A1FF),
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(4)),
              ),
              child: Text(
                '发布',
                style: TextStyle(
                  fontSize: AdapterUtils.getSp(16),
                  color: Colors.white,
                  fontWeight: FontWeight.w500,
                ),
              ))),
     
      SizedBox(
        height: AdapterUtils.getHeight(16),
      ),
    ]));
  }

  List<Widget> _buildProductPicturesWidget(OrderAddViewModel viewModel) {
    List<Widget> list = List<Widget>();
    viewModel.productPictures.forEach((element) {
      list.add(InkWell(
        onTap: () {},
        child: Container(
          width: AdapterUtils.getWidth(108),
          height: AdapterUtils.getHeight(108),
          child: Stack(
            children: <Widget>[
              AspectRatio(
                  aspectRatio: 1.0,
                  child: Image.network(element, fit: BoxFit.cover)),
              Positioned(
                  top: AdapterUtils.getHeight(10),
                  right: AdapterUtils.getWidth(22),
                  child: InkWell(
                    onTap: () {
                      viewModel.delProductPictures(context, element);
                    },
                    child: Container(
                      alignment: Alignment.center,
                      width: 24,
                      height: 24,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.all(Radius.circular(12)),
                        color: Color(0xff000000).withOpacity(0.6),
                      ),
                      child: Icon(Icons.close, color: Colors.white, size: 16),
                    ),
                  ))
            ],
          ),
        ),
      ));
    });
    if (viewModel.productPictures.length < 9) {
      list.add(InkWell(
        onTap: () {
          viewModel.selectPhoto(context, 1);
        },
        child: Container(
          width: AdapterUtils.getWidth(108),
          height: AdapterUtils.getHeight(108),
          child: Stack(
            children: <Widget>[
              AspectRatio(
                  aspectRatio: 1.0,
                  child: Image.asset(
                      AssetsUtils.getAssetsImagesPath('upload.png'),
                      fit: BoxFit.cover)),
              Positioned(
                  bottom: AdapterUtils.getHeight(17),
                  child: Container(
                    alignment: Alignment.center,
                    width: AdapterUtils.getWidth(108),
                    child: RichText(
                      text: TextSpan(children: <InlineSpan>[
                        TextSpan(
                            text: '上传图片（',
                            style: TextStyle(
                              fontSize: AdapterUtils.getSp(12),
                              color: Color(0xff99A2AD),
                              fontWeight: FontWeight.w500,
                            )),
                        TextSpan(
                            text: viewModel.productPictures.length.toString(),
                            style: TextStyle(
                              fontSize: AdapterUtils.getSp(12),
                              color: Color(0xff15A1FF),
                              fontWeight: FontWeight.w500,
                            )),
                        TextSpan(
                            text: '/9）',
                            style: TextStyle(
                              fontSize: AdapterUtils.getSp(12),
                              color: Color(0xff99A2AD),
                              fontWeight: FontWeight.w500,
                            )),
                      ]),
                    ),
                  ))
            ],
          ),
        ),
      ));
    }

    return list;
  }
}
